home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / Oberon⁄F™ 1.2 / Preinstalled version / Obx / Docu / Address1 (.txt) < prev    next >
Encoding:
Oberon Document  |  1996-07-08  |  3.9 KB  |  73 lines  |  [oODC/obnF]

  1. Documents.StdDocumentDesc
  2. Documents.DocumentDesc
  3. Containers.ViewDesc
  4. Views.ViewDesc
  5. Stores.StoreDesc
  6. Documents.ModelDesc
  7. Containers.ModelDesc
  8. Models.ModelDesc
  9. Stores.ElemDesc
  10. TextViews.StdViewDesc
  11. TextViews.ViewDesc
  12. TextModels.StdModelDesc
  13. TextModels.ModelDesc
  14. TextModels.AttributesDesc
  15. Helvetica
  16. Helvetica
  17. Helvetica
  18. Helvetica
  19. Helvetica
  20. TextRulers.StdRulerDesc
  21. TextRulers.RulerDesc
  22. TextRulers.StdStyleDesc
  23. TextRulers.StyleDesc
  24. TextRulers.AttributesDesc
  25. Helvetica
  26. MODULE ObxAddress1;
  27.     IMPORT Views, TextModels, TextMappers, TextViews;
  28.         adr*: RECORD
  29.             name*:    ARRAY 64 OF CHAR;
  30.             street*:    ARRAY 64 OF CHAR;
  31.             city*:        ARRAY 24 OF CHAR;
  32.             state*:    ARRAY   6 OF CHAR;
  33.             ZIP*:        ARRAY   6 OF CHAR;
  34.             country*:    ARRAY 16 OF CHAR;
  35.             customer*:    LONGINT;
  36.             update*:    BOOLEAN;
  37.             Text*:    PROCEDURE
  38.         END;
  39.     PROCEDURE Text;
  40.         VAR t: TextModels.Model; f: TextMappers.Formatter; v: Views.View;
  41.     BEGIN
  42.         t := TextModels.dir.New();
  43.         f.ConnectTo(t);
  44.         f.WriteString(adr.name); f.WriteTab;
  45.         f.WriteString(adr.street); f.WriteTab;
  46.         f.WriteString(adr.city); f.WriteTab;
  47.         f.WriteString(adr.state); f.WriteTab;
  48.         f.WriteString(adr.ZIP); f.WriteTab;
  49.         f.WriteString(adr.country); f.WriteTab;
  50.         f.WriteInt(adr.customer); f.WriteTab;
  51.         f.WriteBool(adr.update); f.WriteLn;
  52.         v := TextViews.dir.New(t);
  53.         Views.OpenView(v)
  54.     END Text;
  55. BEGIN
  56.     adr.Text := Text
  57. END ObxAddress1.
  58. TextControllers.StdCtrlDesc
  59. TextControllers.ControllerDesc
  60. Containers.ControllerDesc
  61. Controllers.ControllerDesc
  62. Helvetica
  63. Helvetica
  64. Helvetica
  65. Oberon by Example: ObxAddress1
  66. This example combines some features of the previous examples: it takes the address record of ObxAddress1  and adds behavior to it. Such a record, whose fields are displayed by controls, is called an interactor.
  67. The behavior for our example interactor is defined through the assignment of the global Text procedure to the adr.Text record field. The procedure creates a new text, into which it writes all the fields of the address record. The fields are written as one line of text, separated by tabulators and terminated by a carriage return. A new text view on this text is then opened in a window.
  68. After the example has been compiled, and after a form has been created for it and turned into a dialog, you can enter something into the fields (note that customer only accepts numeric values). Then click in the Text button. A window will be opened with a contents similar to the following:
  69. Oberon microsystems    Solothurnerstr. 45    Basel    BS    4053    Switzerland    1    $TRUE
  70. In this example, we have seen how behavior can be added to interactors, by assigning global procedures to their procedure-typed fields.
  71. Helvetica
  72. Documents.ControllerDesc
  73.